(function () {
    var EVENT_CLICK = Laya.Event.CLICK;
    var io = ppt.io;

    function roleBox(i) {
        roleBox.super(this);
        this.type = i;
        this.rolebtn = null;
        this.roledetails = null;
        this.roleNum = 1;
        
        this.init();
    }
    Laya.class(roleBox, "Com.Role.box", Laya.Sprite);
    var _proto = roleBox.prototype;

    _proto.init = function () {
        this.createUI();
    }
    _proto.createUI = function (data) {
        var roledetails = new Com.Role.Details();
        roledetails.y = -320;
        roledetails.x = 400;
        this.roledetails = roledetails;
        var rolebtn = new Com.Role.Btn(function (starLength, skillNum, chipNum) {
            roledetails.skillAll(starLength, skillNum, chipNum);
        }.bind(this), this.type);
        rolebtn.x = 80;
        this.rolebtn = rolebtn;
        this.addChildren(roledetails, rolebtn);
    }
    _proto.upData = function (data) {
        if (this.roleNum == 1) {
            this.roleNum++;
            this.rolebtn.btnData(data, this.type);
        }

        this.roledetails.detailData(data, this.type);
    }
    _proto.boxData = function (data) {
        this.rolebtn.moneyData(data);
    }
    _proto.upSkillData = function (data){
        this.roledetails.allSkillData(data);
    }
})();